<?php
    require "sql.php";
    $key =$_POST['key'];
    $data = array();
    $erro = array(
        'code'=>0
    );
    $i=0;
    $username =$_COOKIE['username'];
    $str="select * from file where author = '".$username."'";
    if($key=='zhonger'){
        $result=$conn->query($str);
        if ($result->num_rows > 0) {
            while($row = $result->fetch_assoc()) {
                $data[$i]['filename']=$row['file_name'];
                $data[$i]['isPublic']=$row['isPublic'];
                $data[$i]['create_time']=$row['create_time'];
                $data[$i]['update_time']=$row['update_time'];
                $i++;
            }
            echo json_encode($data);
        } else {
            echo json_encode($erro);
        }
        $conn->close();  
    }
